import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    num:10,
    city:"武汉"
  },
  mutations: {
    add(state){
      state.num++; 
      // console.log(state)
    },
    changeStateCity(state,val){
       state.city = val;
    }
  },
  actions: {
    addNum(ctx){
       ctx.commit("add")
    },
    changeCity(ctx,val){
       ctx.commit("changeStateCity",val);
    }
  },
  modules: {
  }
})
